package com.spic.business.violation.supervision.speed.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.spic.business.violation.supervision.speed.mapper.ViolationsSpeedRecordMapper;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spic.business.violation.supervision.speed.mapper.ViolationsSpeedRecordDirtyMapper;
import com.spic.business.violation.supervision.speed.domain.ViolationsSpeedRecordDirty;
import com.spic.business.violation.supervision.speed.service.IViolationsSpeedRecordDirtyService;

/**
 * 超速记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-11-24
 */
@Service
public class ViolationsSpeedRecordDirtyServiceImpl implements IViolationsSpeedRecordDirtyService 
{
    @Autowired
    private ViolationsSpeedRecordDirtyMapper violationsSpeedRecordDirtyMapper;
    @Autowired
    private ViolationsSpeedRecordMapper violationsSpeedRecordMapper;

    /**
     * 查询超速记录
     * 
     * @param id 超速记录主键
     * @return 超速记录
     */
    @Override
    public ViolationsSpeedRecordDirty selectViolationsSpeedRecordDirtyById(Long id)
    {
        return violationsSpeedRecordDirtyMapper.selectViolationsSpeedRecordDirtyById(id);
    }

    /**
     * 查询超速记录列表
     * 
     * @param violationsSpeedRecordDirty 超速记录
     * @return 超速记录
     */
    @Override
    public List<ViolationsSpeedRecordDirty> selectViolationsSpeedRecordDirtyList(ViolationsSpeedRecordDirty violationsSpeedRecordDirty)
    {
        return violationsSpeedRecordDirtyMapper.selectViolationsSpeedRecordDirtyList(violationsSpeedRecordDirty);
    }

    /**
     * 新增超速记录
     * 
     * @param violationsSpeedRecordDirty 超速记录
     * @return 结果
     */
    @Override
    public int insertViolationsSpeedRecordDirty(ViolationsSpeedRecordDirty violationsSpeedRecordDirty)
    {
        return violationsSpeedRecordDirtyMapper.insertViolationsSpeedRecordDirty(violationsSpeedRecordDirty);
    }

    /**
     * 修改超速记录
     * 
     * @param violationsSpeedRecordDirty 超速记录
     * @return 结果
     */
    @Override
    public int updateViolationsSpeedRecordDirty(ViolationsSpeedRecordDirty violationsSpeedRecordDirty)
    {
        return violationsSpeedRecordDirtyMapper.updateViolationsSpeedRecordDirty(violationsSpeedRecordDirty);
    }

    /**
     * 批量删除超速记录
     * 
     * @param ids 需要删除的超速记录主键
     * @return 结果
     */
    @Override
    public int deleteViolationsSpeedRecordDirtyByIds(Long[] ids)
    {
        return violationsSpeedRecordDirtyMapper.deleteViolationsSpeedRecordDirtyByIds(ids);
    }

    /**
     * 删除超速记录信息
     * 
     * @param id 超速记录主键
     * @return 结果
     */
    @Override
    public int deleteViolationsSpeedRecordDirtyById(Long id)
    {
        return violationsSpeedRecordDirtyMapper.deleteViolationsSpeedRecordDirtyById(id);
    }

    @Override
    public Map<String, Integer> statistics() {
        Integer all = 0, allDirty = 0, incomplete = 0, incorrect = 0;
        all = violationsSpeedRecordMapper.allCount();
        allDirty = violationsSpeedRecordDirtyMapper.allDirtyCount();
        incomplete = violationsSpeedRecordDirtyMapper.incompleteCount();
        incorrect = violationsSpeedRecordDirtyMapper.incorrectCount();
        Map<String, Integer> map = new HashMap<>();
        map.put("all", all);
        map.put("allDirty", allDirty);
        map.put("incomplete", incomplete);
        map.put("incorrect", incorrect);
        return map;
    }
}
